package net.lab1024.sa.admin.module.business.erp.mmo.controller;

import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.MrnordAddForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.MrnordQueryForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.MrnordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.vo.MrnordVO;
import net.lab1024.sa.admin.module.business.erp.mmo.service.MrnordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 领料通知单 Controller
 *
 * @Author AKITA
 * @Date 2025-08-17 17:01:16
 * @Copyright AKITA
 */

@RestController
@Tag(name = "领料通知单")
public class MrnordController {

    @Resource
    private MrnordService mrnordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/mrnord/queryPage")
    public ResponseDTO<PageResult<MrnordVO>> queryPage(@RequestBody @Valid MrnordQueryForm queryForm) {
        return ResponseDTO.ok(mrnordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/mrnord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid MrnordAddForm addForm) {
        return mrnordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/mrnord/update")
    public ResponseDTO<String> update(@RequestBody @Valid MrnordUpdateForm updateForm) {
        return mrnordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/mrnord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return mrnordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/mrnord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return mrnordService.delete(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/mrnord/info/{docEntry}")
    public ResponseDTO<MrnordVO> info(@PathVariable Long docEntry) {
        return mrnordService.info(docEntry);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/mrnord/infoUnexecute/{id}")
    public ResponseDTO<MrnordVO> infoUnexecute(@PathVariable Long id) {
        return mrnordService.infoUnexecute(id);
    }

}
